package com.luck.of.wise.somenslider.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.preference.PreferenceManager;

public class SPHandler {
	
	static SPHandler mInstance;
    static Context mContext;
    static SharedPreferences mSP;
	static SharedPreferences.Editor mEditor;
	
	static final String SHOW_MESSAGE = "show_message";
	
	boolean mShowMessage;
	
    public static synchronized SPHandler getInstance(Context context){
        if (mInstance == null) {
        	mContext = context;
            mInstance = new SPHandler(mContext);
        }
        return mInstance;
    }

	private SPHandler(Context context){
		mSP = PreferenceManager.getDefaultSharedPreferences(context);
		mEditor = mSP.edit();
		mShowMessage = mSP.getBoolean(SHOW_MESSAGE, true);
		
	}
	
	public void setShowMessage(boolean value) {
		mEditor.putBoolean(SHOW_MESSAGE, value);
		mEditor.commit();
	}

	public boolean showMessage() {
		return mSP.getBoolean(SHOW_MESSAGE, true);
	}
	
}
